﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XRpgLibrary.Events
{
    public interface IDestroy
    {
        void destroy();
    }
    public class DestroyList
    {
        public static DestroyList Instance
        {
            get
            {
                if (_instance == null)
                    _instance = new DestroyList();
                return _instance;
            }
        }
        public void add(IDestroy obj)
        {
            _destroyObjects.Add(obj);
        }
        public void destroyAll()
        {
            while (_destroyObjects.Count > 0)
            {
                _destroyObjects[0].destroy();
                _destroyObjects.RemoveAt(0);
            }
        }
        private List<IDestroy> _destroyObjects = new List<IDestroy>();
        private static DestroyList _instance;
    }
}
